
import React from 'react';
import { Icon, List } from 'weaver-mobile';
import { getLabel } from '../../util/common';
import './style/index.less'

const Item = List.Item;
export default class WfNoPermission extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            params: {
                requestid: "2645735",
                requestidlabel: "流程ID",
                requestname: "标准产品需求评审- 岁军攀 - 2018 - 03 - 08（需求标  题：【1324】公文交换平台需求）",
                requestnamelabel: "流程标题",
                workflowpath: "标准产品需求评审",
                workflowpathlabel: "所属路径",
                creator: "岁军攀",
                creatorlabel: "创建人",
                createtime: "2018-03-08 16:30:42",
                createtimelabel: "创建时间",
                nowNode: "评审",
                nowNodelabel: "当前节点",
                nowState: "评审",
                nowStatelabel: "当前状况",
                noOperator: "高士杰 徐如晶 董雷 杨国生 李笑笑 马琳琳 沈隽磊",
                noOperatorlabel: "当前未操作者",
            }
        };
    }
    componentDidMount() {
        const { params = {} } = this.props;
        if (JSON.stringify(params) !== "{}") {
            this.setState({ params });
        }
    }

    getLi = () => {
        const { requestid, requestidlabel, requestname, requestnamelabel, workflowpath,
            workflowpathlabel, creator, creatorlabel, createtime, createtimelabel, nowNode, nowNodelabel, nowState, nowStatelabel, noOperator, noOperatorlabel } = this.state.params;
        return (
            <ul className='ul'>
               
                <li>
                    <div className="wf-no-permission-label">{requestidlabel}</div>
                    <div className="wf-no-permission-value">{requestid}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{requestnamelabel}</div>
                    <div className="wf-no-permission-value">{requestname}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{workflowpathlabel}</div>
                    <div className="wf-no-permission-value">{workflowpath}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{creatorlabel}</div>
                    <div className="wf-no-permission-value">{creator}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{createtimelabel}</div>
                    <div className="wf-no-permission-value">{createtime}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{nowNodelabel}</div>
                    <div className="wf-no-permission-value">{nowNode}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{nowStatelabel}</div>
                    <div className="wf-no-permission-value">{nowState}</div>
                </li>
                <li>
                    <div className="wf-no-permission-label">{noOperatorlabel}</div>
                    <div className="wf-no-permission-value">{noOperator}</div>
                </li>
            </ul>
        )
    }

    render() {
        const nodata = <div>请检查组件是否传参</div>

        if (JSON.stringify(this.state.params) === "{}") {
            return nodata;
        } else {
            return (
                <div className='wf-monitor-no-permission'>
                    <div className='render-header'>您无权限查看流程表单，当前显示流程信息</div>
                    {this.getLi()}
                </div>
            )
        }

    }
}
